package main

import (
	"encoding/hex"
	"fmt"
	"WeiXinCode/区块链学习/01_day_hd/blockChain"
)

/**
//1.定义区块结构
	//>1.前区块哈希
	//>2.当前区块哈希
	//>3.数据
//2.创建区块
//3.生成哈希
//4.引入区块链
//5.添加区块
//6.重构代码
*/

func main() {
	fmt.Println("hello word!")
	//block := NewBlock("新世界就见到来，我将代表新人类！", []byte{0x0000000000000000})
	bc := blockChain.NewBlockChain()
	bc.AddBlock([]byte("我是第二名哈哈哈！"))
	bc.AddBlock([]byte("我是第三名哈哈哈！"))
	for _,block := range bc.Blocks {
		fmt.Println("---------------------------------------------")
		fmt.Println("PrevBlockHash:", hex.EncodeToString(block.PrevBlockHash))
		fmt.Println("this Hash:", hex.EncodeToString(block.Hash))
		fmt.Println("data:", string(block.Data))
	}
}
